package cn.jkgly.wxImg.controller;

import cn.jkgly.wxImg.entity.WxImg;

import cn.jkgly.wxImg.service.IWxImgService;
import cn.jkgly.wxUser.entity.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api("微信图片查询接口")
public class WxImgController {
    @Autowired
    IWxImgService iWxImgService;
    @GetMapping("/auth/getWxImg")
    public Result getWx(@RequestParam String openid,@RequestParam String type){
        QueryWrapper<WxImg> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("openid",openid).eq("type",type);
        WxImg wxImg1 = iWxImgService.getOne(queryWrapper);
        if (wxImg1!=null){
          return   Result.ok(wxImg1);
        }
       return Result.error("未查询到图片");
    }
}
